home *** CD-ROM | disk | FTP | other *** search
Wrap
/* ** $VER: Emboss_fast.ieb 1.11, IE Arexx script ** Image Engineer Batch Processing script ** Copyright © by Patrik M Nydensten ** 27/1 1997 Stockholm/Sweden ** ** Emboss image using Composite/Subtract. */ options results signal on error parse arg input command input = upper(strip(input)) address 'IMAGEENGINEER' select /* Required batch script commands */ when input = 'INFO' then return get_info() when input = 'CONFIG' then return get_config(command) when input = 'PROCESS' then return process_image(command) otherwise do 'REQUEST' '"Failure in call to batch script!"' '" Quit "' return '<ERROR>' end end exit 0 /* Required "Get_info" procedure ------------------------------------ */ /* S = SECONDARY, A = ALPHA, 1 = Single file, 2 = Multiple files */ get_info: back = 'OK' return back /* Required "Get_config" procedure ---------------------------------- */ get_config: parse arg '"'command'"' Xoff=2 ; Yoff=2 ; Boost=0 if command ~= '' then parse var command Xoff Yoff '#'BoostCol Boost 'IE_TO_FRONT' form = 'FORM "Emboss fast" " OK | Cancel "', ' INTEGER,"X emboss",-16,16,'Xoff',SLIDER', ' INTEGER,"Y emboss",-16,16,'Yoff',SLIDER' if command = '' then form = form||' CYCLE,"Edge colors:","Make them grey|Keep / Boost",0' form = form||' INTEGER,"Color boost",0,255,'Boost',SLIDER' form if command = '' then do parse var result ok Xoff Yoff BoostCol Boost . if ok = 0 then return '<ERROR>' end else do parse var result ok Xoff Yoff Boost . if ok = 0 then return '<ERROR>' BoostCol = 'none' end back = Xoff Yoff '#'BoostCol Boost return back /* Required "Process_image" procedure ------------------------------- */ process_image: parse arg '"'src_image'"' '"'dst_image'"' '"'options'"' parse var options Xoff Yoff '#'BoostCol Boost . if BoostCol=1 then 'OPEN' '"'src_image'"' '24' else 'OPEN' '"'src_image'"' '8' if (RC ~= 0) then do 'IE_TO_FRONT' 'REQUEST' '"Failed to load image:' d2c(10)||src_image'"' '" OK "' return '<ERROR>' end else LoadImage = result 'PROJECT_INFO' LoadImage 'WIDTH' /* Get width of image */ IW = RESULT 'PROJECT_INFO' LoadImage 'HEIGHT' /* Get height of image */ IH = RESULT if Xoff > IW then Xoff = IW if Yoff > IH then Yoff = IH 'MARK' LoadImage 'PRIMARY' 'MARK' LoadImage 'SECONDARY' 'COMPOSITE' Xoff Yoff 'SUBTRACT' OutputImage = result 'CLOSE' LoadImage if BoostCol = 1 then do /* boost colors */ 'SATURATION' OutputImage Boost NewOutputImage = Result 'CLOSE' OutputImage OutputImage = NewOutputImage end else if left(getclip('cfg_save_frmt'),4)~='ILBM' then do 'CONVERT_TO_COLOUR' OutputImage TempImage = result 'CLOSE' OutputImage OutputImage = TempImage end if getclip('cfg_save_frmt')='' then setclip('cfg_save_frmt','ILBM CmpByteRun1') 'SAVE_DATA' OutputImage '"'dst_image'"' '"'getclip('cfg_save_frmt')'"' if (RC ~= 0) then do 'IE_TO_FRONT' 'REQUEST' '"Failed to save image:' d2c(10)||dst_image'"' '" OK "' return '<ERROR>' end 'CLOSE' OutputImage back = 'OK' return back /* Internal procedures ---------------------------------------------- */ /*******************************************************************/ /* This is where control goes when an error code is returned by IE */ /* It puts up a message saying what happened and on which line */ /*******************************************************************/ error: if RC=5 then do IE_TO_FRONT LAST_ERROR 'REQUEST "'||RESULT||'"' end else do IE_TO_FRONT LAST_ERROR 'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!' end return '<ERROR>'